from functools import reduce


def f(x):
    return x * x


r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9])


# print(list(r))
def str2int(s):
    def fn(x, y):
        return x * 10 + y

    def char2num(s):
        return {'0': 0, '1': 1, '2': 2, '3': 3}[s]

    return reduce(fn, map(char2num, s))


print(str2int(['0', '1', '2', '3']))


def normalize(name):
    return name[0].upper() + name[1::].lower()


L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)


def prod(ll):
    reduce(lambda a: a * 1, ll)



print('3 * 5 * 7 * 9 =', prod([3, 5, 7, 9]))
